﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ESHOP.DAO;
using ESHOP.UTIL;
using ESHOP.Domain;
using E_Shop.Common;
namespace E_Shop
{
    public partial class Shopping : System.Web.UI.MasterPage
    {
        DanhMucDAO _danhmucDao = new DanhMucDAO();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[Constants.SESSION_LOGIN] == null)
            {
                Response.Redirect(WebUrl.LOGIN, true);
            }
            else
            {
                if (!IsPostBack)
                {
                    LoadDuLieu();
                }
            }
        }
        private void LoadDuLieu()
        {
            CommonFunc.BindDropDownList(ddlCatalog, _danhmucDao.GetList(), "TENDM", "ID", true);
            var lst = _danhmucDao.GetList();
            repeatmenu.DataSource = lst;
            repeatmenu.DataBind();
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            String textsearch = txtsearch.Text.Trim();
            String id = ddlCatalog.SelectedValue.ToString();
            String url = String.Format("ShoppingProductSearch.aspx?&id={0}&textsearch={1}", id, textsearch);
            Response.Redirect(url, true);
        }
    }
}